import React, { PureComponent } from 'react';
import "../../styles/Index/Mine.scss"
import { getuserinfo } from "../../api/index"

import Header from "../../components/Index/Mine/Header"
import User from "../../components/Index/Mine/User"
import OrderState from "../../components/Index/Mine/OrderState"
import ToolsList from "../../components/Index/Mine/ToolsList"

class Mine extends PureComponent {
    state = {
        userinfo: {}
    }
    async componentDidMount() {
        let res = await getuserinfo({ userid: localStorage.getItem("userid") })
        res.data.data && this.setState({ userinfo: res.data.data[0] })
        // console.log(res.data.data[0])

        // if (res.data.data && res.data.data[0].username) {
        //     store.dispatch({
        //         type: 'BINDUSERNAME',
        //         name: res.data.data[0].username
        //     })
        // }
    }
    render() {
        return (
            <div className='mine'>
                <Header />
                <User userinfo={this.state.userinfo} />
                <OrderState />
                <ToolsList userinfo={this.state.userinfo} />
            </div>
        );
    }
}

export default Mine;